Ext.define('DCApp.view.EventList', {
    extend: 'Ext.grid.Panel',
    alias: 'widget.eventlist',
    store:Ext.create('Ext.data.ArrayStore', {
        storeId: 'st_event1',
        model:'DCApp.model.Event1'
    }),
    bAni : false,
    columns: [
          {
              text: 'p1',
              dataIndex: 'p1',
              width:150
          },
          {
              text: 'p2',
              dataIndex: 'p2',
              width:200
          },
          {
              text: 'p3',
              dataIndex: 'p3',
              width:300,
              formatter: 'date("H:i:s m/d/Y")'
          }
         ],   
    startAni:function(){
    	var me=this;
    	me.Ani=true;
    	var row = me.getView().getNode(0);
		me.rowHeight = Ext.get(row).getHeight();
    	me.timer=setTimeout(function(){
    		me.aniStep();
    	},2000);
    },
    stopAni:function(){
    	var me=this;
    	me.Ani=false;
    	if(me.timer){
    		clearTimeout(me.timer);
    		me.timer=false;
    	}
    	me.getView().scrollTo(0,0,false);
    },
    aniStep:function(){
    	var me=this;
    	if(!me.Ani)
    		return false;
    	var gv = me.getView();
    	gv.scrollBy(0,me.rowHeight,true);
    	if(gv.getScrollY()+ me.rowHeight>=gv.getEl().dom.scrollHeight){
    		gv.scrollTo(0,0,false);
    	}
    	me.timer = setTimeout(function(){
    		me.aniStep();
    	},2000);
    },
    initComponent: function(){
    	var me=this;
    	me.callParent();
    }         
 });
